#!/usr/bin/env bash
git pull
mvn clean package -DskipTests
BALL_PID=ball_pid
if [ -f "$BALL_PID" ] && kill -0 $(cat "$BALL_PID"); then
	echo "=========进程在运行。。。准备杀死"
	PID="$(cat "$BALL_PID")"
	kill $PID
	rm -rf "$BALL_PID"
	echo "=========进程kill完成,准备启动==========="
fi
rm -f ./nohup.out
nohup java -jar -Xms512m -Xmx1g ./target/*.jar --spring.profiles.active=prod >> ./nohup.out 2>&1 & echo $! > $BALL_PID
echo "=========启动完成========="